package com.ft.adbix.utils;

import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

import com.ft.adbix.utils.data.gather.common.DataGatherManager;
import com.ft.adbix.utils.data.gather.util.ClassUtils;

public class WxSupportChecker {

    public static boolean checkWxSupport(){
        boolean isComplied = ClassUtils.isLibraryCompile("com.tencent.mm.opensdk.openapi.IWXAPI");
        return isComplied && isWeChatInstalled();
    }

    private static boolean isWeChatInstalled() {
        PackageManager packageManager = DataGatherManager.getInstance().getContext().getPackageManager();
        try {
            PackageInfo packageInfo = packageManager.getPackageInfo("com.tencent.mm", PackageManager.GET_ACTIVITIES);
            return packageInfo != null;
        } catch (PackageManager.NameNotFoundException e) {
            return false;
        }
    }

}
